<?php
/**
 * Created By PhpStorm
 * Author: patrick wu
 * Date: 2020/10/24
 * Time: 9:34
 */
namespace App\Http\Controllers\Api;

use App\Service\Api\MemberService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use App\Constant\ErrorConstant;

class MemberController extends BaseController
{
    protected $service;

    public function __construct(Request $request, MemberService $service)
    {
        parent::__construct($request);
        $this->service  =   $service;
    }

    /**
     * 会员招募
     * @return \Illuminate\Http\JsonResponse
     * @throws \GuzzleHttp\Exception\GuzzleException
     */
    public function shopMember()
    {
        [$flag, $result]    =   $this->service->memberShop();
        if ($flag) {
            return $this->successResponse($result);
        } else {
            return $this->errorResponse(ErrorConstant::API_MEMBER_SHOP_ERROR, $result);
        }
    }
}
